package com.zhongfl.crm.model.boss;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhongfl.crm.annotation.FieldMeta;
import com.zhongfl.crm.enums.boss.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * tb_order
 * Created by wangkun23 on 2018/1/17.
 */
@ToString
public class Order implements Serializable {
    /*自增ID*/
    @Setter
    @Getter
    private Integer id;

    /*订单号*/
    @Setter
    @Getter
    private String orderNo;

    /**
     * 励销交付订单ID
     */
    @Setter
    @Getter
    private Long lxDeliverOrderId;

    /**
     * 客户订单号
     */
    @Setter
    @Getter
    private String customerOrderNo;

    /*客户姓名*/
    @Setter
    @Getter
    @FieldMeta(name = "客户姓名")
    private String name;

    /*客户手机号*/
    @Setter
    @Getter
    private String mobile;


    @Setter
    @Getter
    private Integer businessManagerAmibaId;
    @Setter
    @Getter
    private String businessManagerAmibaName;
    /*商务经理的StaffCode*/
    @Setter
    @Getter
    private String businessManagerStaffCode;
    /*商务经理*/
    @Setter
    @Getter
    @FieldMeta(name = "商务经理")
    private String businessManager;
    /*商务经理手机号*/
    @Setter
    @Getter
    private String businessManagerMobile;


    /*交付经理经理手机号*/
    @Setter
    @Getter
    private String deliverManagerMobile;

    @Setter
    @Getter
    private Integer deliverManagerAmibaId;

    @Setter
    @Getter
    private String deliverManagerAmibaName;

    /*交付经理的StaffCode*/
    @Setter
    @Getter
    private String deliverManagerStaffCode;
    /*商务经理的id*/
    @Setter
    @Getter
    private Integer businessManagerId;

    /*交付经理*/
    @Setter
    @Getter
    @FieldMeta(name = "交付经理")
    private String deliverManager;

    /**
     * 渠道id
     */
    @Setter
    @Getter
    private Integer channelId;

    /*订单渠道名称*/
    @Setter
    @Getter
    @FieldMeta(name = "渠道")
    private String channelName;

    /*借款金额*/
    @Setter
    @Getter
    @FieldMeta(name = "贷款金额")
    private BigDecimal loanAmount;

    /*借款期限*/
    @Setter
    @Getter
    @FieldMeta(name = "贷款期限")
    private Integer loanDuration;

    /*贷款利率*/
    @Setter
    @Getter
    @FieldMeta(name = "贷款利率")
    private BigDecimal rate;

    /*总服务费率*/
    @Setter
    @Getter
    @FieldMeta(name = "服务费率")
    private BigDecimal totalFeeRate;

    /*服务费金额*/
    @Setter
    @Getter
    @FieldMeta(name = "总服务费")
    private BigDecimal serviceAmount;

    /*渠道佣金费率*/
    @Setter
    @Getter
    @FieldMeta(name = "渠道返率")
    private BigDecimal channelRate;

    /*渠道佣金金额*/
    @Setter
    @Getter
    @FieldMeta(name = "渠道返费")
    private BigDecimal channelFee;

    /*报单时间*/
    @Setter
    @Getter
    private Date submitTime;

    /*创建人*/
    @Setter
    @Getter
    private String createdBy;

    /**
     * 原订单状态
     */
    @Setter
    @Getter
    private OrderStatus originalStatus;

    /*订单状态*/
    @Setter
    @Getter
    private OrderStatus status;

    private int statusIndex;

    public int getStatusIndex() {
        if (status != null) {
            return status.getIndex();
        }
        return 0;
    }

    private String statusName;/*工单名称*/

    public String getStatusName() {
        if (status != null) {
            return status.getValue();
        }
        return "";
    }

    /*订单备注*/
    @Setter
    @Getter
    private String remark;

    /**
     * 操作人
     */
    @Getter
    @Setter
    private String operStaffCode;

    /*创建时间*/
    @Setter
    @Getter
    private Date createdTime;

    /*更新时间*/
    @Setter
    @Getter
    private Date modifiedTime;

    @Setter
    @Getter
    private Integer unSettledCount;

    /*是否紧急*/
    @Setter
    @Getter
    private Integer isUrgent;

    /**
     * 当前用户关注状态
     */
    @Setter
    @Getter
    private Boolean followStatus;

    /**
     * 支行名称
     */
    @Setter
    @Getter
    private String branchBankName;

    /**
     * 分行
     */
    @Setter
    @Getter
    private String masterBank;

    /**
     * 银行logo
     */
    @Setter
    @Getter
    private String bankLogo;

    /**
     * 综合评分
     */
    @Setter
    @Getter
    private String averageGrade;

    /**
     * 评分项size
     */
    @Setter
    @Getter
    private Integer gradeSize;

    @JsonFormat(pattern = "MM-dd")
    @DateTimeFormat(pattern = "MM-dd")
    @Getter
    @Setter
    private Date instoreTime;


    @Getter
    @Setter
    private String assistantMobile;

    @Getter
    @Setter
    private String businessAssistantStaffCode;


    @Getter
    @Setter
    private String businessAssistant;

    @Getter
    @Setter
    private Integer businessAssistantId;

    @Getter
    @Setter
    private Date closedTime;

    @Getter
    @Setter
    private Date loanedTime;


    /**
     * 当前状态入库时间
     */
    @Getter
    @Setter
    private String currentStatusInStoreTime;

    /**
     * 当前状态对应工单号（前端分配交付经理使用）
     */
    @Setter
    @Getter
    private String currentStatusWorkOrderNo;

    /**
     * 订单来源
     */
    @Getter
    @Setter
    private OrderSource source;


    /**
     * 婚姻状况
     */
    @Getter
    @Setter
    private BomMaritalStatus maritalStatus;

    /**
     * 有无实控
     */
    @Getter
    @Setter
    private BomControlStatus hasControl;

    /**
     * 有无三方
     */
    @Getter
    @Setter
    private BomThirdPartyStatus hasOther;


    @Getter
    @Setter
    private String currentStaffCode;


    @Setter
    @Getter
    private  String currentStaffName;


    /**批贷金额*/
    @Getter
    @Setter
    private BigDecimal approvalAmount;


    /**
     * 是否一次性通过批贷
     */
    @Getter
    @Setter
    private Integer passByOneTime;

    /**
     * 非一次性批贷原因
     */
    @Getter
    @Setter
    private ReasonType approveReason;

    /**
     * 是否一次性放款
     */
    @Getter
    @Setter
    private Integer oneTimeLoaned;

    /**
     * 非一次性放款原因
     */
    @Getter
    @Setter
    private ReasonType loanedReason;

    /**
     * 房本入库时间
     */
    @Getter
    @Setter
    private Date houseEntryTime;

    /**
     * 确认一次性通过
     */
    @Setter
    @Getter
    private Integer confirmPassByOneTime;

    @Setter
    @Getter
    private Integer orderConfirmId;

    @Setter
    @Getter
    private Integer deliverBankId;

    /**
     * 是否是正常报卷订单
     */
    @Setter
    @Getter
    private Boolean isNormalRolls;

    /**
     * 是否是正常批贷订单
     */
    @Setter
    @Getter
    private Boolean isNormalApprove;

    /**
     * 是否是正常放款订单
     */
    @Setter
    @Getter
    private Boolean isNormalLoaned;

    /**
     * 是否走云科
     */
    @Setter
    @Getter
    private Boolean isUseYunke;

    /**
     * 产品id
     */
    @Setter
    @Getter
    private Integer productId;
}